import Router from 'koa-router'
import rolesController from '@/controller/roles.controller'
import { vertifyAuth } from '@/middleware/auth.middleware'
import { verifyAddRole, verifyEditRole } from '@/middleware/roles.middleware'
import { verifyPagingSearch } from '@/middleware/common.middleware'

const rolesRouter = new Router({prefix: '/roles'})

rolesRouter.get('/list', vertifyAuth, verifyPagingSearch, rolesController.getList)
rolesRouter.post('/add', vertifyAuth, verifyAddRole, rolesController.create)
rolesRouter.put('/edit', vertifyAuth, verifyEditRole, rolesController.editRole)
rolesRouter.delete('/del', vertifyAuth, rolesController.delRole)
rolesRouter.get('/getMenuByRole', vertifyAuth, rolesController.getMenuByRole)
rolesRouter.post('/configPermissions', vertifyAuth, rolesController.configPermissions)

export default rolesRouter